home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: Can't debug into a function; likely a code problem
- Date: 03 Mar 1996 19:53:55 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar3125355@qcd.lanl.gov>
- References: <1773FC4EBS86.JW1675A@american.edu>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: JW1675A@american.edu's message of Sun, 03 Mar 96 14:00:11 EST
-
- In article <1773FC4EBS86.JW1675A@american.edu>
- JW1675A@american.edu (James D. Watson) writes:
-
- <snip>
- JDW: if(!readRecord(sFilename, getType1, (void*)&(rec.t1))) {
- JDW: /* error */
-
- readRecord has not yet been declared. So, it is assumed to have a
- declaration `int readRecord()', which means all arguments are promoted
- when possible. In particular, the getType1 which is an enum becomes
- either an int or an unsigned int. Similarly, because no prototype is
- in scope, the last parameter is left as (void*) and not converted to
- what the function expects.
-
- <snip>
- JDW: bool readRecord(const char *sFilename, const TYPE_TO_GET eWhich,
- JDW: (void**)ptr) {
-
- if bool is not an int, or if TYPE_TO_GET is not compatible with
- whatever it gets promoted to, this definition is in error (or to say
- it another way, the previous call is in error)
-
- Further, this expects the last parameter to be void**. You are passing
- a void*.
-
- <snip>
- JDW: /* nothing done with f or any of the parameters yet */
- JDW: if(!openFile(&f, eWhich, "rb", (const char *sFilename))) {
-
- What is the last argument? Does this code compile on your compiler?
-
- As openFile is not declared either, problems similar to that described
- above are present.
-
- <snip>
- JDW: bool openFile(FILE **f, const TYPE_TO_GET eWhich, const char *sMode,
- JDW: const char *sFilename) {
-
- Cheers
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-